package cc.deng.wubo.minapp.controller;

import cc.deng.wubo.minapp.beans.FileUploadInfo;
import cc.deng.wubo.minapp.beans.SysUser;
import cc.deng.wubo.minapp.core.base.Result;
import cc.deng.wubo.minapp.service.FileUploadService;
import cc.deng.wubo.minapp.utils.StringUtil;
import org.nutz.filepool.NutFilePool;
import org.nutz.json.Json;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpSession;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2018/3/17.
 */
@SuppressWarnings("all")
@Controller
public class IndexController {


    @RequestMapping("/")
    public String root(){



        return "redirect:/login.html";
    }
    @RequestMapping("/index")
    public String index(){

        return "redirect:/index.html";
    }
    @RequestMapping("/auth/error/{type}")
    @ResponseBody
    public Map<String,Object> error(@PathVariable("type") String type){
        Map<String,Object> map = new HashMap<>();

        map.put("success",false);
        map.put("errorInfo",type);
        return  map;

    }


    @RequestMapping("/test/login")
    @ResponseBody
    public Object testLongin(HttpSession session){
        SysUser currentUser = (SysUser) session.getAttribute("currentUser");

        return Json.toJson(currentUser);
    }





}
